
<html>
<body><br>

<?php if (isset($this->status)):?>
    &nbsp;<font color="#800080"><?php echo $this->escape($this->status);?></font>
<?php else: ?>
<?php
if (count($this->paginator)):
    foreach ($this->paginator as $order): ?>

    <div><font color="#800080">
    &nbsp;Order date:&nbsp;<?php echo $this->escape($order->order_date);?><hr></font>

    <table class="mytable"><tr>
            <th align="center">Product name</th>
            <th align="center">Quantity</th>
            <th align="center">Price</th>
        </tr>

    <?php
    // retrieve order detail
    $orderDetail = new OrderDetailDAO();
    $orderDetailList = $orderDetail->getOrderDetailListByID($order->id);
    $product = new Product(); // for retrieve producer name
    foreach ($orderDetailList as $ordetail): ?>
        <tr>
            <td><?php $proRow = $product->fetchRow('id='.$ordetail->product_id); echo $this->escape($proRow->name);?></td>
            <td><?php echo $this->escape($ordetail->quantity);?></td>
            <td><?php echo $this->escape($ordetail->price);?></td>
        </tr>
    <?php endforeach; echo "</table>";?>
    <br><table class="mytable">
    <tr>
        <th align="center">Receive date</th>
        <th align="center">Receiver name</th>
        <th align="center">Receiver address</th>
        <th align="center">Receiver phone</th>
        <th align="center">Total</th>
    </tr>
    <tr>
        

        <td><?php echo $this->escape($order->receive_date);?></td>
        <td><?php echo $this->escape($order->receiver_name);?></td>
        <td><?php echo $this->escape($order->receiver_address);?></td>
        <td><?php echo $this->escape($order->receiver_phone);?></td>
        <td><?php echo $this->escape($order->total);?></td>
    </tr>
    </table>
    </div>
    <br><br><br>
<?php endforeach; endif; ?>
<?= $this->paginationControl($this->paginator,
                             'Sliding',
                             'pagination.phtml'); ?>

<?php endif;?>
</body>
</html>